<nav id="page-nav" class="clearfix">
  {{- with .Paginator }}
    {{- $currentPageNumber := .PageNumber }}

    {{- $slots := 7 }}
    {{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
    {{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
    {{- if lt (add (sub $end $start) 1) $slots }}
      {{- $start = math.Max 1 (add (sub $end $slots) 1) }}
    {{- end }}

    {{- with .First }}
      {{- if ne $currentPageNumber .PageNumber }}
      <a class="extend first" aria-label="First" rel="first" role="button" href="{{ .URL }}"><span></span>首页</a>
      {{- end }}
    {{- end }}

    {{- with .Prev }}
    <a class="extend prev" aria-label="Prev" rel="prev" role="button" href="{{ .URL }}"><span></span>上一页</a>
    {{- end }}

    {{- if lt .First.PageNumber $start }}
      <span>...</span>
    {{- end }}

    {{- range $k := seq $start $end }}
      {{- if eq $.Paginator.PageNumber $k }}
      <a class="page-number current" aria-label="Page {{ $k }}" role="button">{{ $k }}</a>
      {{- else }}
      <a class="page-number" href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" role="button">{{ $k }}</a>
      {{- end }}
    {{- end }}

    {{- if gt .Last.PageNumber $end }}
      <span>...</span>
    {{- end }}


    {{- with .Last }}
      {{- if ne $currentPageNumber .PageNumber }}
      <a class="extend last" aria-label="Last" rel="last" role="button" href="{{ .URL }}">尾页<span></span></a>
      {{- end }}
    {{- end }}

    {{- with .Next }}
      <a class="extend next" aria-label="Next" rel="next" role="button" href="{{ .URL }}">下一页<span></span></a>
    {{- end }}
  {{- end }}
</nav>